home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TSPA3370.ZIP / TSUNTH.INT < prev    next >
Text File  |  1993-06-13  |  6KB  |  160 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT H
  5. A Turbo Pascal unit of system information and more miscellania
  6. All rights reserved 24-Feb-90
  7. Updated 15-Apr-90, 23-Jul-90, 1-Aug-90, 8-Aug-90, 5-Jan-90, 22-Jul-91
  8.         24-Nov-91, 23-Aug-92, 4-Feb-93, 13-Jun-93
  9.  
  10. In the 24-Nov-91 update part of the old routines has been transferred to
  11. TSUTNTJ because this TSUNTH unit started to grow too much.  The transferred
  12. routines were
  13.   COPYFILE Copy a file from within a Turbo Pascal program
  14.   ISDIRFN  Is a name a directory or not
  15.   OPENEDFN Is an assigned textfile still open or not
  16.   PIPEDIFN Is the standard input from redirection
  17.   PIPEDNFN Is the standard output redirected to nul
  18.   PIPEDOFN Is the standard output redirected
  19.  
  20. In the 23-Aug-92 update one of the old routines has been transferred to
  21. a new TSUNTK which harbors the MsDos 4.+ specific routines.
  22.   BOOTDRFN Get boot device name (MsDos 4.+)
  23.  
  24. In the 4-Feb-93 update replaced CHIPFN processor detection routine
  25. by the CPUFN function.
  26.  
  27. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  28. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  29. ANY other usage, such as use in a business enterprise or a university,
  30. contact the author for the terms of registration.
  31.  
  32. The units are under development. Comments and contacts are solicited. If
  33. you have any questions, please do not hesitate to use electronic mail for
  34. communication.
  35. InterNet address: ts@uwasa.fi         (preferred)
  36. Bitnet address:   SALMI@FINFUN.BITNET
  37.  
  38. The author shall not be liable to the user for any direct, indirect or
  39. consequential loss arising from the use of, or inability to use, any unit,
  40. program or file howsoever caused. No warranty is given that the units and
  41. programs will work under all circumstances.
  42.  
  43. Timo Salmi
  44. Professor of Accounting and Business Finance
  45. Faculty of Accounting & Industrial Management; University of Vaasa
  46. P.O. BOX 297, SF-65101 Vaasa, Finland
  47. *)
  48.  
  49. unit TSUNTH;
  50.  
  51. (* ======================================================================= *)
  52.                           interface
  53. (* ======================================================================= *)
  54.  
  55. uses Dos
  56.      {$IFDEF VER40}
  57.      ,TSUNT45
  58.      {$ENDIF}
  59.      ;
  60.  
  61. (* ====================================================================
  62.                   Software information
  63.    ==================================================================== *)
  64.  
  65. (* Graftabl MsDos command loads the extended character set to be used in
  66.    the graphics mode.  This function tells whether the table has been
  67.    already loaded, or not *)
  68. function GRTABLFN : boolean;
  69.  
  70. (* Returns the country code if MsDos 3+. For an error and earlier MsDos
  71.    versions returns zero. See MsDos manual "How to use Code Pages" for
  72.    the country codes *)
  73. function COUNTRFN : word;
  74.  
  75. (* Return the country-dependent date format, reguires 3.0+,
  76.    Principal return formats: MM-DD-YY       ('-' or whatever is the
  77.                              DD-MM-YY        relevant separator)
  78.                              YY-MM-DD
  79.    On error or MsDos < 3.0 returns ('XX*XX*XX');
  80.    Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
  81. function DATEFMFN : string;
  82.  
  83. (* Return the country-dependent time format, reguires 3.0+,
  84.    Principal return formats: 12-hour HH:MM:SS   (':' or whatever is the
  85.                              24-hour HH:MM:SS    relevant separator)
  86.    On error or MsDos < 3.0 returns ('00h');
  87.    Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
  88. function TIMEFMFN : string;
  89.  
  90. (* ====================================================================
  91.                   Hardware information
  92.    ==================================================================== *)
  93.  
  94. (* Returns the type of the processor chip
  95.      0 = 8086/88
  96.      2 = 80286
  97.      3 = 80386
  98.      4 = 80486
  99.    The function is based on the assembler code from Dettmann & Johnson,
  100.    Dos Programmers Reference, 3rd Edition, Que, 1992
  101.    The inline conversion by Duncan Murdoch is acknowledged with my
  102.    best thanks *)
  103. function CPUFN : byte;
  104.  
  105. (* Is a math coprocessor present. And, yes, yes, I know that there is a
  106.    Test8087 variable in Turbo Pascal, but I have found it unreliable *)
  107. function MATHCOFN : boolean;
  108.  
  109. (* Number of serial ports *)
  110. function RS232FN : byte;
  111.  
  112. (* Number of parallel ports (printers installed) *)
  113. function PARPORFN : byte;
  114.  
  115. (* Is mouse hardware and driver present, a simple true / false test *)
  116. function ISMOUSFN : boolean;
  117.  
  118. (* Status of the mouse hardware and driver
  119.    0 : no mouse
  120.    1 : mouse with other than two buttons
  121.    2 : mouse with two buttons
  122.    3 : Mouse Systems or Logitech mouse
  123.    4 : Unknown or unresolved mouse status *)
  124. function MOUSTAFN : byte;
  125.  
  126. (* Get the version (date) of the ROM BIOS. It is of the format mm/dd/yy.
  127.    Returns 'NotKnown' if unavailable *)
  128. function ROMDTEFN : string;
  129.  
  130. (* Is the keyboard an enhanced keyboard *)
  131. function ISENHAFN : boolean;
  132.  
  133. (* Last drive of the system, softcoded, not for XTs *)
  134. function LASTDRFN : char;
  135.  
  136. (* This function gives the interleave factor of a given drive.
  137.    If you give a non-existent drive name, interlfn return zero.
  138.    This is for fixed disks. Applying on a floppy drive will give
  139.    nonsensical values, not for XTs. I am not convinced that this
  140.    works with all the different conrollers around *)
  141. function INTERLFN (drive : char) : byte;
  142.  
  143. (* Number of FATs, not for XTs *)
  144. function FATSFN (drive : char) : byte;
  145.  
  146. (* Number of cylinders on a device, requires MsDos 3.2+.
  147.    In case of modia not present, error, or wrong MsDos version,
  148.    returns 0 *)
  149. function NRCYLFN (drive : char) : byte;
  150.  
  151. (* ====================================================================
  152.                       Perform tasks
  153.    ==================================================================== *)
  154.  
  155. (* Convert an Asciiz (#0 limited) string into an ordinary ascii string.
  156.    Some of the routines in this unit internally need Z2ASCFN, but why
  157.    not make it also generally available as well *)
  158. function Z2ASCFN (asciiz : string) : string;
  159.  
  160.